package com.dailycodebuffer.springbootmongodb.service;


import com.dailycodebuffer.springbootmongodb.collection.Employee;
import com.dailycodebuffer.springbootmongodb.repository.EmployeeRepository;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;


/**
 * 业务层
 *
 * @author makejava
 * @since 2025-01-04 00:23:42
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {

	@Resource
    private EmployeeRepository employeeRepository;

    @Override
    public void save(Employee employee) {
        employeeRepository.save(employee);
    }


    @Override
    public Employee findById(Integer id) {
        return employeeRepository.findById(id).orElse(null);
    }


    @Override
    public Page<Employee> list(Pageable page) {
        return employeeRepository.findAll(page);
    }

}

